from selenium import webdriver
from scrapy import Selector
from selenium.common.exceptions import NoSuchElementException

chrome_browser = webdriver.Chrome(executable_path="/Users/great/Downloads/chromedriver")
chrome_browser.get("https://item.jd.com/100008348542.html")

try:
    click_ele = chrome_browser.find_element_by_xpath("//li[@clstag='shangpin|keycount|product|shangpinpingjia_1']")
    click_ele.click()
except NoSuchElementException as e:
    pass

sel = Selector(text=chrome_browser.page_source)
print(sel.xpath("//span[@class='price J-p-100008348542']/text()").extract()[0])

chrome_browser.close()  # 关闭浏览器
